package net.csdn.business.enums;

import net.csdn.business.common.enums.UserTypeEnum;

public enum MileStoneStateEnum {

    ACTIVE("active",1,"已开启"),
    CLOSED("closed",2,"已关闭");

    public String migrateStateName;
    public Integer migrateStateInt;
    public String migrateStateDesc;

    MileStoneStateEnum(String migrateStateName, Integer migrateStateInt, String migrateStateDesc) {
        this.migrateStateName = migrateStateName;
        this.migrateStateInt = migrateStateInt;
        this.migrateStateDesc = migrateStateDesc;
    }

    public static MileStoneStateEnum getStateName(String stateName) throws IllegalArgumentException {
        for (MileStoneStateEnum mileStone : MileStoneStateEnum.values()) {
            if (mileStone.migrateStateName.equals(stateName)) {
                return mileStone;
            }
        }
        throw new IllegalArgumentException("MileStoneStateEnum param error");
    }

    public static MileStoneStateEnum getIntegerState(Integer type) throws IllegalArgumentException {
        for (MileStoneStateEnum mileStone : MileStoneStateEnum.values()) {
            if (mileStone.migrateStateInt.equals(type)) {
                return mileStone;
            }
        }
        throw new IllegalArgumentException("MileStoneStateEnum param error");
    }
}
